<template>
    <el-dialog v-model="dialogVisible" :destroy-on-close="true" :align-center="true" width="80%" title="零工岗位详情">
      <el-form :model="dialogData.itemInfo" label-width="100px" label-suffix=" :">
        <div class="job-wrapper">
          <div class="opt-title-box">
            <div class="info-title">岗位基本信息</div>
          </div>
          <div class="info-box">
            <div class="left-box">
              <el-row :gutter="20">
                <el-col :span="24" class="title">{{ dialogData.itemInfo.title }}</el-col>
              </el-row>
              <el-row>
                <el-col :span="24" class="info"> {{ dialogData.itemInfo.typeName }} </el-col>
              </el-row>
              <el-row>
                <el-col :span="4" class="sub-title">当前状态</el-col>
                <el-col :span="4" class="sub-title">企业/个人</el-col>
                <el-col :span="4" class="sub-title">浏览量</el-col>
                <el-col :span="4" class="sub-title">发布时间</el-col>
              </el-row>
              <el-row>
                <el-col :span="4" class="info">
                  <el-tag type="primary">{{ filterEnum(dialogData.itemInfo.status, jobStatusType) }}</el-tag>
                </el-col>
                <el-col :span="4" class="info">
                  <el-tag type="primary"> {{ filterEnum(dialogData.itemInfo.flagCompany, FlagCompanyTypes) }}</el-tag>
                </el-col>
                <el-col :span="4" class="info">{{ dialogData.itemInfo.viewCnt || "-" }}</el-col>
                <el-col :span="4" class="info">{{ dialogData.itemInfo.pubDate || "-" }}</el-col>
              </el-row>
              <el-row>
                <el-col :span="4" class="sub-title">是否可议价</el-col>
                <el-col :span="4" class="sub-title">发布价格</el-col>
                <el-col :span="4" class="sub-title">成交价格</el-col>
                <el-col :span="4" class="sub-title">成交时间</el-col>
              </el-row>
              <el-row>
                <el-col :span="4" class="info">
                  <el-tag type="primary">{{ dialogData.itemInfo.flagTalk == "Y" ? "是" : "否" || "-" }}</el-tag>
                </el-col>
                <el-col :span="4" class="job-amt">{{ dialogData.itemInfo.priceAmt || "-" }}</el-col>
                <el-col :span="4" class="job-amt">{{ dialogData.itemInfo?.settleVo?.dealAmt || "-" }}</el-col>
                <el-col :span="4" class="info">{{ dialogData.itemInfo?.settleVo?.dealDate || "-" }}</el-col>
              </el-row>
              <el-row> <el-col :span="24" class="sub-title">工作地址</el-col> </el-row>
              <el-row>
                <el-col :span="24">
                  {{ getAddressPC(dialogData.itemInfo.jobAddress) || "-" }}
                  {{ getAddressDetail(dialogData.itemInfo.jobAddress) }}
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="8" class="sub-title">联系人</el-col>
                <el-col :span="8" class="sub-title">发布企业</el-col>
              </el-row>
              <el-row>
                <el-col :span="8" class="info">
                  {{ dialogData.itemInfo.contactor || "-" }}
                </el-col>
                <el-col :span="8" class="info">{{ dialogData.itemInfo.pubCompanyName || "-" }}</el-col>
              </el-row>
            </div>
            <div class="right-box">
              <el-row class="user-item-box">
                <el-col :span="4">
                  <div class="item-image">
                    <img :src="getAvatorUrl(dialogData.itemInfo.userAvator)" />
                  </div>
                </el-col>
                <el-col :span="6">
                  <el-row class="item-center"> {{ dialogData.itemInfo.pubUserName || "-" }} </el-row>
                  <el-row class="sub-title"> 发布人 </el-row>
                </el-col>
                <el-col :span="14">
                  <el-row class="item-center">
                    <el-rate v-model="dialogData.itemInfo.pubScore" disabled text-color="#ff9900" score-template="{value}" />
                  </el-row>
                  <!-- <el-row class="sub-title"> 评分 </el-row> -->
                </el-col>
              </el-row>
              <el-row class="user-item-box">
                <el-col :span="4">
                  <div class="item-image">
                    <img :src="getAvatorUrl(dialogData.itemInfo.settleVo?.applyUserAvator)" />
                  </div>
                </el-col>
                <el-col :span="6">
                  <el-row class="item-center"> {{ dialogData.itemInfo.settleVo?.applyUserName || "-" }} </el-row>
                  <el-row class="item-center"> {{ dialogData.itemInfo.settleVo?.applyUserPhone || "-" }} </el-row>
                  <el-row class="sub-title"> 承接人 </el-row>
                </el-col>
                <el-col :span="4">
                  <el-row class="item-center">
                    <el-button v-if="!dialogData.itemInfo.settleVo?.dealScore" type="primary" @click="handleOpenCommentDialog">我要评价</el-button>
                    <el-rate v-if="!!dialogData.itemInfo.settleVo?.dealScore" v-model="dialogData.itemInfo.settleVo.dealScore" disabled text-color="#ff9900"  />
                  </el-row>
                  <!-- <el-row class="sub-title"> 评分 </el-row> -->
                </el-col>
              </el-row>
              <el-row class="contactor-box">
                <el-col :offset="4">
                  <!-- <el-button :icon="Link" type="primary" link> 电子合同 : {{ dialogData.itemInfo.dealCode || "-" }}</el-button> -->
                  <div class="">
                    <span class="text">
                      电子合同 :
                      <a href="http://qwzls.oss-cn-hangzhou.aliyuncs.com/recruit/static/fxjob/fxjobpubcontract.pdf" target="_blank">{{ dialogData.itemInfo.dealCode || "" }}</a>
                    </span>
                  </div>
                </el-col>
              </el-row>
            </div>
          </div>
          <div class="opt-title-box">
            <div class="info-title">岗位进度</div>
          </div>
          <div class="process-box">
            <el-steps :active="dialogData.curStep" align-center>
              <el-step v-for="item in dialogData.stepsData" :title="item.title" :key="item.vaue" >
                <template #description>
                  <!-- && !item.description -->
                   <div v-if="item.value == '5' ">
                    <el-button type="primary" @click="handleOpenPayDialog">去支付</el-button>
                  </div>
                  <div v-if="item.value == '6' ">
                    <el-button type="danger" @click="handleOpenAbnormalDialog">提出异议</el-button>
                  </div>
                  <div v-if="item.value === '7' ">
                    <el-button type="primary" @click="confimJobDone">完工确认</el-button>
                  </div>
                  <span class="job-info">{{ item.description }}</span>
                </template>
              </el-step>
            </el-steps>
          </div>
          <div class="opt-title-box">
            <div class="info-title">详细信息</div>
          </div>
          <div class="process-box">
            <el-tabs type="border-card" @tab-change="handleTabChange">
              <el-tab-pane label="日志记录">
                <el-scrollbar height="400px">
                  <el-timeline>
                    <el-timeline-item
                      v-for="item in dialogData.processData"
                      :key="item.id"
                      :timestamp="item.createDate"
                      placement="top"
                    >
                      <el-card>
                        <div class="process-item-box">
                          <div class="left-box">
                            <div class="item-image">
                              <img :src="getAvatorUrl(item.processUserAvator)" alt="用户头像" />
                            </div>
                          </div>
                          <div class="right-box">
                            <div class="process-item-user">{{ item.processUserName }}</div>
                            <div class="process-item-info">{{ item.content }}</div>
                          </div>
                        </div>
                      </el-card>
                    </el-timeline-item>
                  </el-timeline>
                </el-scrollbar>
              </el-tab-pane>
              <el-tab-pane label="申请记录">
                <ProTable ref="pTable" :columns="columns" :request-api="getTableList">
                  <template #applyUserName="scope">
                    <div class="apply-user-box">
                      <div class="item-image">
                        <img :src="getAvatorUrl(scope.row.applyUserAvator)" alt="用户头像" />
                      </div>
                      <div class="right-box">
                        <div class="rate-item">
                          <el-rate v-model="scope.row.applyUserScore" disabled text-color="#ff9900" score-template="{value}" />
                        </div>
                        <div class="item-user">
                          {{ scope.row.applyUserName }} <span class="item-flag" v-if="scope.row.flagDeal == 'Y'">已申请</span>
                        </div>
                      </div>
                    </div>
                  </template>
                  <template #quoteAmt="scope">
                    <div class="apply-amt-box">
                      <div class="apply-amt">{{ scope.row.quoteAmt }}</div>
                      <div class="apply-date">{{ scope.row.quoteDate }}</div>
                      <div class="apply-opt">
                        <el-button v-if="scope.row.quoteAmt" @click="confimApplyPrice(scope.row)" type="primary" size="small"  >
                          确认价格
                        </el-button>
                        <el-button :disabled="scope.row.flagDeal === 'Y'" type="primary" size="small" @click="confimApplyer(scope.row)" >
                          确认接单
                        </el-button>
                        <el-button :disabled="scope.row.flagDeal !== 'Y'" type="primary" size="small" @click="cancelConfimApplyer(scope.row)" >
                          取消确认
                        </el-button>
                      </div>
                    </div>
                  </template>
                  <template #jobAmt="scope">
                    <div class="apply-amt-box">
                      <div class="apply-amt">{{ scope.row.jobAmt }}</div>
                      <div class="apply-date">{{ scope.row.jobDate }}</div>
                    </div>
                  </template>
                  <template #status="scope">
                    <el-tag :type="scope.row.status === sysEnum.TEN ? '' : 'info'">
                      {{ filterEnum(scope.row.status, sysStatusType) }}
                    </el-tag>
                  </template>
                  <template #operation="scope">
                    <el-button type="primary" :icon="EditPen" size="small" text @click="handleOpenTalkPriceDialog(scope.row)">
                      议价
                    </el-button>
                    <el-button type="danger" :icon="Delete" size="small" text @click="handleDeleteApplyItem(scope.row)">
                      删除
                    </el-button>
                  </template>
                </ProTable>
              </el-tab-pane>
              <el-tab-pane label="交易记录">
                <el-scrollbar height="400px">
                  <div v-for="item in dialogData.guaranteeData" :key="item.id" class="pay-box-wrapper">
                    <el-card shadow="always">
                      <template #header>
                        <div class="item-image">
                          <img :src="getAvatorUrl(item.payUserAvator)" alt="用户头像" />
                        </div>
                        <div class="item-info">
                          {{ item.payUserName }}
                        </div>
                      </template>
                      <div class="pay-item-box">
                        <div class="pay-item-left-box">
                          <el-descriptions class="margin-top" title="付款信息" column="1" border>
                            <el-descriptions-item>
                              <template #label>
                                <div class="cell-item">
                                  <el-icon>
                                    <Wallet />
                                  </el-icon>
                                  付款方式
                                </div>
                              </template>
                              <el-tag type="primary">{{ filterEnum(item.payType, PayTypes) }}</el-tag>
                            </el-descriptions-item>
                            <el-descriptions-item>
                              <template #label>
                                <div class="cell-item">
                                  <el-icon>
                                    <Mug />
                                  </el-icon>
                                  支付状态
                                </div>
                              </template>
                              <el-tag type="primary">{{ filterEnum(item.status, paidStatusType) }}</el-tag>
                            </el-descriptions-item>
                            <el-descriptions-item>
                              <template #label>
                                <div class="cell-item">
                                  <el-icon>
                                    <Clock />
                                  </el-icon>
                                  付款日期
                                </div>
                              </template>
                              {{ item.payDay }}
                            </el-descriptions-item>
                            <el-descriptions-item>
                              <template #label>
                                <div class="cell-item">
                                  <el-icon>
                                    <Money />
                                  </el-icon>
                                  付款金额
                                </div>
                              </template>
                              {{ item.payAmt }}
                            </el-descriptions-item>
                            <el-descriptions-item>
                              <template #label>
                                <div class="cell-item">
                                  <el-icon>
                                    <Paperclip />
                                  </el-icon>
                                  付款单号
                                </div>
                              </template>
                              {{ item.payNo }}
                            </el-descriptions-item>
                          </el-descriptions>
                        </div>
                        <div class="pay-item-right-box">
                          <el-descriptions class="margin-top" title="到帐信息" column="1" border>
                            <el-descriptions-item>
                              <template #label>
                                <div class="cell-item">
                                  <el-icon>
                                    <Clock />
                                  </el-icon>
                                  到帐日期
                                </div>
                              </template>
                              {{ item.settleDay }}
                            </el-descriptions-item>
                            <el-descriptions-item>
                              <template #label>
                                <div class="cell-item">
                                  <el-icon>
                                    <Money />
                                  </el-icon>
                                  到帐金额
                                </div>
                              </template>
                              {{ item.settleAmt }}
                            </el-descriptions-item>
                            <el-descriptions-item>
                              <template #label>
                                <div class="cell-item">
                                  <el-icon>
                                    <Paperclip />
                                  </el-icon>
                                  到帐单号
                                </div>
                              </template>
                              {{ item.settleNo }}
                            </el-descriptions-item>
                          </el-descriptions>
                        </div>
                      </div>
                    </el-card>
                  </div>
                </el-scrollbar>
              </el-tab-pane>
              <el-tab-pane label="岗位图片">
                <UploadImgs v-model:fileList="dialogData.fileList" :disabled="true" :file-size="3" width="160px" height="160px">
                </UploadImgs>
              </el-tab-pane>
              <el-tab-pane label="职位描述">
                <WangEditor height="600px" v-model:value="dialogData.itemInfo.content" />
              </el-tab-pane>
              <el-tab-pane label="完工凭证">
                <UploadImgs v-model:fileList="dialogData.donefileList" :disabled="true" :file-size="3" width="160px" height="160px">
                </UploadImgs>
                <div class="done-box-wrapper">
                  <el-descriptions title="完工信息" column="1" border>
                    <el-descriptions-item>
                      <template #label>
                        <div class="cell-item">
                          <el-icon>
                            <Clock />
                          </el-icon>
                          申请完工日期
                        </div>
                      </template>
                      {{ dialogData.doneInfoData?.applyDoneDate }}
                    </el-descriptions-item>
                    <el-descriptions-item>
                      <template #label>
                        <div class="cell-item">
                          <el-icon>
                            <Paperclip />
                          </el-icon>
                          申请完工说明
                        </div>
                      </template>
                      {{ dialogData.doneInfoData?.applyDoneContent || "" }}
                    </el-descriptions-item>
                    <el-descriptions-item>
                      <template #label>
                        <div class="cell-item">
                          <el-icon>
                            <Clock />
                          </el-icon>
                          完工日期
                        </div>
                      </template>
                      {{ dialogData.doneInfoData?.doneDate }}
                    </el-descriptions-item>
                  </el-descriptions>
                </div>
              </el-tab-pane>
            </el-tabs>
          </div>
        </div>
      </el-form>
      <template #footer>
        <el-button @click="dialogVisible = false">关闭</el-button>
      </template>
      <TalkPriceDialog ref="tpDialogRef" @refresh-list="handleRefreshSettle" />
      <CommentDialog ref="ctDialogRef" @refresh-list="handleRefreshSettle" />
      <AbnormalDialog ref="abDialogRef" />
      <PayDialog ref="payDialogRef" />
    </el-dialog>
  </template>
  
  <script setup lang="ts">
  import { OptEnum, sysEnum } from "@/biz/eenum/appEnum";
  import { DialogParam } from "@/biz/interface/DialogType";
  import { reactive, ref } from "vue";
  import WangEditor from "@/components/WangEditor/index.vue";
  // import { Close, Check } from "@element-plus/icons-vue";
  import { ElMessage, TabPaneName } from "element-plus";
  import { filterEnum } from "@/utils";
  import { getCurStep, getJobSteps, getAddressPC, getAddressDetail } from "@/utils/jobutil";
  import { jobStatusType, FlagCompanyTypes, PayTypes } from "@/biz/datas/appData";
  import { sysStatusType, paidStatusType } from "@/biz/datas/sysData";
  import { FlexJobEntity } from "@/biz/interface/FlexjobType";
  import {
    getFlexJobInfoApi,
    getWorkerApplyVoListApi,
    deleteWorkerApplyApi,
    getJobProcessesApi,
    getJobGuaranteeApi,
    getJobDoneInfoApi
  } from "@/api/modules/sysflexjob/job";
  import { cancelConfirmApplyerApi, confirmApplyPriceApi, confirmApplyerApi, confirmJobDoneApi } from "@/api/modules/cpyjob/flexjob";
  import defaultAvatar from "@/assets/images/davator.png";
  import UploadImgs from "@/components/Upload/Imgs.vue";
  import ProTable from "@/components/ProTable/index.vue";
  import { ColumnProps } from "@/components/ProTable/interface";
  import { Delete, EditPen, Link } from "@element-plus/icons-vue";
  import { useHandleData } from "@/hooks/useHandleData";
  // 议价页面
  import TalkPriceDialog from "./components/TalkPriceDialog.vue";
  // 评价页面
  import CommentDialog from "./components/CommentDialog.vue";
  // 评价页面
  import AbnormalDialog from "./components/AbnormalDialog.vue";
  // 支付页面
  import PayDialog from "./components/PayDialog.vue";
  //页面的数据
  interface JobDialogOption extends DialogParam {
    //弹出表单的标题
    title: string;
  
    //当前的数据对象
    itemInfo: FlexJobEntity;
    curStep: number;
    // 操作步骤
    stepsData: any[];
    // 操作流水
    processData: any[];
    // 支付凭证
    guaranteeData: any[];
    // 完工凭证
    doneInfoData?: any;
    // 资源文件
    fileList: [];
    // 完工文件
    donefileList: [];
  }
  const pTable = ref();
  //弹出框的参数
  const dialogVisible = ref(false);
  //当前表单数据在这里初始化
  const dialogData = reactive<JobDialogOption>({
    optType: OptEnum.UNKNOW,
    title: "",
    itemInfo: {
      id: "",
      title: "",
      typeName: ""
    },
    curStep: 0,
    stepsData: [],
    processData: [],
    guaranteeData: [],
    fileList: [],
    donefileList: []
  });
  
  const getAvatorUrl = (aurl: string) => {
    let url = defaultAvatar;
    if (aurl) {
      url = aurl;
    }
    return url;
  };
  
  //初始化页面的数据
  const initItemInfo = (): void => {
    dialogData.itemInfo = {
      id: "",
      title: "",
      typeName: ""
    };
    dialogData.stepsData = [];
  };
  
  const getItemInfo = async (id: string) => {
    if (id) {
      //通过接口获取数据
      let { data } = await getFlexJobInfoApi({ id });
      // console.log("FlexJobDialog 灵工岗位详情", data);
      if (data) {
        dialogData.itemInfo = data as unknown as FlexJobEntity;
      } else {
        ElMessage.success({ message: "当前企业管理员未上传身份证信息" });
      }
      // console.log("加载当前的岗位信息");
      // 处理当前的进度
      if (dialogData.itemInfo) {
        dialogData.stepsData = getJobSteps(dialogData.itemInfo);
        dialogData.curStep = getCurStep(dialogData.itemInfo.status);
  
        // 默认是要加载操作流程的
        getJobProcesses();
      }
  
      // 加了下面这个就不出数据了。 虽然有数据，去掉就不会停的多加出现
      // dialogData.fileList = [];
      dialogData.fileList.length = 0;
      let imgIdx = 1;
      if (dialogData.itemInfo.imgs) {
        dialogData.itemInfo.imgs.forEach(img => {
          dialogData.fileList.push({ name: imgIdx, url: img });
          imgIdx = imgIdx + 1;
        });
      }
      if (dialogData.itemInfo.vdos) {
        dialogData.itemInfo.vdos.forEach(vdo => {
          dialogData.fileList.push({ name: imgIdx, url: vdo });
          imgIdx = imgIdx + 1;
        });
      }
    }
  };
  
  // 接收父组件传过来的参数
  const acceptParams = (params: DialogParam): void => {
    dialogData.optType = params.optType;
    dialogData.rowData = params.rowData;
  
    // 初始化一下
    initItemInfo();
    if (dialogData.rowData && dialogData.rowData.id) {
      // 加载当前的数据
      getItemInfo(dialogData.rowData.id);
    }
  
    dialogVisible.value = true;
  };
  
  // tab 切换事情
  const handleTabChange = (name: TabPaneName) => {
    console.log(name);
    if (name == 0) {
      // 加载日志流水
      getJobProcesses();
    } else if (name == 1) {
      // 加载申请记录
      handleRefreshApplyList();
    } else if (name == 2) {
      // 加载交易记录
      getJobGuarentee();
    } else if (name == 5) {
      // 加载完工凭证
      getJobDoneInfo();
    }
  };
  
  // 表格列配置
  const columns: Partial<ColumnProps>[] = [
    { type: "index", label: "#", width: 60 },
    {
      prop: "applyUserName",
      label: "申请人",
      width: 300
    },
    {
      prop: "status",
      label: "状态",
      width: 90
    },
    {
      prop: "quoteAmt",
      label: "申请人"
    },
    {
      prop: "jobAmt",
      label: "发岗人"
    },
    {
      prop: "operation",
      width: 200,
      fixed: "right",
      label: "操作"
    }
  ];
  
  //刷新数据列表
  const handleRefreshApplyList = () => {
    pTable.value.getTableList();
  };

    //刷新数据明细
  const handleRefreshDataItem = () => {
    if(dialogData.rowData.id){
      getItemInfo(dialogData.rowData.id);
    }
  };
  
  // 获取岗位的申请记录
  const getTableList = (params: any) => {
    if (dialogData.itemInfo.id) {
      // 这边可以处理一下参数
      let newParams = JSON.parse(JSON.stringify(params));
      if (newParams) {
        newParams.id = dialogData.itemInfo.id;
      }
      return getWorkerApplyVoListApi(newParams) || [];
    }
  };
  
  // 删除信息
  const handleDeleteApplyItem = async (params: { id: string }) => {
    await useHandleData(deleteWorkerApplyApi, { id: params.id! }, `删除【${params.applyUserName}】申请信息`);
    pTable.value.getTableList();
  };
  
  // 加载岗位的操作日志
  const getJobProcesses = async () => {
    if (dialogData.itemInfo.id) {
      let { data } = await getJobProcessesApi({ id: dialogData.itemInfo.id });
      dialogData.processData = data.list as unknown as any[];
      // console.log(dialogData.processData);
    }
  };
  // 加载岗位的操作日志
  const getJobGuarentee = async () => {
    if (dialogData.itemInfo.id) {
      let { data } = await getJobGuaranteeApi({ id: dialogData.itemInfo.id });
      dialogData.guaranteeData = data.guaranteesVo as unknown as any[];
      // console.log(data, dialogData.guaranteeData);
    }
  };
  
  const getJobDoneInfo = async () => {
    if (dialogData.itemInfo.id) {
      let { data } = await getJobDoneInfoApi({ id: dialogData.itemInfo.id });
      dialogData.doneInfoData = data as unknown as any;
      dialogData.donefileList.length = 0;
      let imgIdx = 1;
      if (dialogData.doneInfoData.imgs) {
        dialogData.doneInfoData.imgs.forEach(img => {
          dialogData.donefileList.push({ name: imgIdx, url: img });
          imgIdx = imgIdx + 1;
        });
      }
      if (dialogData.doneInfoData.vdos) {
        dialogData.doneInfoData.vdos.forEach(vdo => {
          dialogData.donefileList.push({ name: imgIdx, url: vdo });
          imgIdx = imgIdx + 1;
        });
      }
      // console.log(data);
    }
  };
  
  //页面事件
  // const emits = defineEmits(["refresh-list"]);
  
  // 确认申请人的价格
  const confimApplyPrice = async (dealer:{})=>{
    // console.log(dealerId);
    if(dealer && dialogData.itemInfo.id){
      await useHandleData(confirmApplyPriceApi, { jobId:  dialogData.itemInfo.id, dealId: dealer.id }, `确认同意申请人:${dealer.applyUserName}的价格`);
      handleRefreshApplyList();
    }
  };

    // 确认申请人
  const confimApplyer = async (dealer:{})=>{
    // console.log(dealerId);
    if(dealer && dialogData.itemInfo.id){
      await useHandleData(confirmApplyerApi, { jobId:  dialogData.itemInfo.id,  dealId: dealer.id }, `确认申请人:${dealer.applyUserName}`);
      handleRefreshApplyList();
    }
  };

  // 取消确认申请人
  const cancelConfimApplyer = async (dealer:{})=>{
    // console.log(dealerId);
    if(dealer && dialogData.itemInfo.id){
      await useHandleData(cancelConfirmApplyerApi, { jobId:  dialogData.itemInfo.id,  dealId: dealer.id }, `确认取消申请人:${dealer.applyUserName}`);
      handleRefreshApplyList();
    }
  };

  // 确认完工
  const confimJobDone = async ()=>{
    // console.log(dealerId);
    if( dialogData.itemInfo.id){
      await useHandleData(confirmJobDoneApi, { id:  dialogData.itemInfo.id }, `确认完工`);
      handleRefreshDataItem();
      handleRefreshApplyList();
    }
  };

  // 打开 议价
const tpDialogRef = ref();
const handleOpenTalkPriceDialog = (rowData?: { id: string }) => {
  let params = {
    optType: OptEnum.EDIT,
    rowData: { ...rowData }
  };
  // console.log("开票弹窗", params);
  tpDialogRef.value.acceptParams(params);
};

// 打开 评价
const ctDialogRef = ref();
const handleOpenCommentDialog = () => {
  // 参数只需要jobId
  let params = {
    optType: OptEnum.EDIT,
    rowData: { jobId:  dialogData.itemInfo.id }
  };
  ctDialogRef.value.acceptParams(params);
};

// 打开 评价
const abDialogRef = ref();
const handleOpenAbnormalDialog = () => {
  // 参数只需要jobId 为 id
  let params = {
    optType: OptEnum.EDIT,
    rowData: { id:  dialogData.itemInfo.id }
  };
  abDialogRef.value.acceptParams(params);
};

// 打开 支付
const payDialogRef = ref();
const handleOpenPayDialog = () => {
  // 参数只需要jobId 为 id
  let params = {
    optType: OptEnum.EDIT,
    rowData: { id:  dialogData.itemInfo.id }
  };
  payDialogRef.value.acceptParams(params);
};

  // 刷新接单信息
  const handleRefreshSettle = ()=>{
    handleRefreshApplyList();
  };

  //页面参数
  defineExpose({
    acceptParams
  });
  </script>
  <style lang="scss" scoped>
  @import "./index.scss";
  </style>
  